const Router = require("koa-router");
const router = new Router()
const home = require("../controllers/home");
const music = require("../controllers/music");
const my = require("../controllers/my");
const myForm = require("../controllers/myForm")
const routers = [
    {
        path:"/home",
        component:home
    },
    {
        path:"/music",
        component:music
    },
    {
        path:"/my",
        component:my,
        method:"post"
    },
    {
        path:"/form",
        component:myForm,
        method:"post"
    },
]
routers.forEach(item=>{
    if(item.method=="post"){
        router.post(item.path,item.component)
    }
    else{
        router.get(item.path,item.component)
    }
})
module.exports = router